<?php
namespace app\common\model;

class MemberProduct extends Base
{
    protected $table = 'member_products';

    public function getProductTitleAttr($value, $data)
    {
        $product = Product::where('id', $data['product_id'])->find();
        if (empty($product)) {
            return '';
        }

        return $product['title'];
    }
	
	public function getProductNameAttr($value, $data)
    {
        $product = Platform::where('id', $data['product_id'])->find();
        if (empty($product)) {
            return '';
        }

        return $product['name'];
    }
	
	public function getProductLogoAttr($value, $data)
    {
        $product = Platform::where('id', $data['product_id'])->find();
        if (empty($product)) {
            return '';
        }

        return $product['logo'];
    }

    public function getCreateTimeLabelAttr($value, $data)
    {
        if (!empty($data['create_time'])) {
            return date('Y-m-d H:i:s', $data['create_time']);
        }
        return '';
    }
}